package cn.com.selfsoft.smartcity.core.controller;

import cn.com.selfsoft.smartcity.commons.enums.ResultCode;
import cn.com.selfsoft.smartcity.commons.http.ResultModel;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 捕捉404异常
 *
 *
 */
//@RestController
public class NotFoundExceptionController implements ErrorController {

    @Override
    public String getErrorPath() {
        return "/error";
    }

    @GetMapping(value = {"/error"})
    @RequestMapping
    public ResponseEntity<ResultModel> error(HttpServletRequest request) {
        return ResponseEntity.ok().body(new ResultModel(ResultCode.NOT_FOUND));
    }


}
